package com.campus.common.mapper;

import com.campus.common.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    // 通过用户名查询用户
    @Select("select * from `user` where username = #{username} ")
    public User selectByUsername(String username);

    // 通过邮箱查询用户
    @Select("select * from `user` where email = #{email}")
    public User selectByEmail(String email);

    // 通过手机号查询用户
    @Select("select * from `user` where phone_number = #{phoneNumber}")
    public User selectByPhoneNumber(String phoneNumber);
    @Insert("insert into user(user_id, username, email, password) value(#{userId}, #{username}, #{email}, #{password})")
    public int insert(User user);
}
